import request from "@/utils/request";

// 配货列表
export function listPrepare(query) {
  return request({
    url: "/mes/sale/shipment/list",
    method: "get",
    params: query,
  });
}

// 批量修改仓库
export function updatePrepareWarehouse(data) {
  return request({
    url: "/mes/sale/prepare/updateWarehouse",
    method: "put",
    data: data,
  });
}

// 批量修改物流公司
export function updatePrepareExpress(data) {
  return request({
    url: "/mes/sale/prepare/updateExpress",
    method: "put",
    data: data,
  });
}

// 批量转现货订单
export function updatePrepareStock(data) {
  return request({
    url: "/mes/sale/prepare/inStock",
    method: "put",
    data: data,
  });
}

// 全部配货/部分配货
export function prepare(data) {
  return request({
    url: "/mes/sale/prepare/prepare",
    method: "put",
    data: data,
  });
}

// 手工配货
export function manualPrepare(data) {
  return request({
    url: "/mes/sale/prepare/manualPrepare",
    method: "put",
    data: data,
  });
}

// 获取配货单发货信息
export function getPrepareDelivery(prepareId) {
  return request({
    url: "/mes/sale/prepare/listOrderDelivery/" + prepareId,
    method: "get",
  });
}

// 获取配货单商品信息
export function getPrepareItems(prepareId) {
  return request({
    url: "/mes/sale/prepareLine/listLine/" + prepareId,
    method: "get",
  });
}

// 获取配货单商品，库存信息
export function getPrepareItemsStock(prepareId) {
  return request({
    url: "/mes/sale/prepare/listItemStock/" + prepareId,
    method: "get",
  });
}

// 批量反审核
export function withdrewAudit(data) {
  return request({
    url: "/mes/sale/prepare/withdrewAudit",
    method: "put",
    data: data,
  });
}

// 商品明细
export function getOrderProductList(prepareId) {
  return request({
    url: `/mes/sale/prepare/listOrderProduct/${prepareId}`, // API请求地址，使用模板字符串动态拼接prepareId
    method: "get", // 使用GET请求方法
  });
}

// 拆单
export function splitOrder(data) {
  return request({
    url: "/mes/sale/prepare/split",
    method: "put",
    data: data,
  });
}

// 发货tab列表信息
export function listShipment(prepareId) {
  return request({
    url: `/mes/sale/prepare/listShipment/${prepareId}`,
    method: "get",
  });
}

// 发货单作废
export function cancelShipment(data) {
  return request({
    url: "/mes/sale/shipmentPrint/cancel",
    method: "put",
    data: data,
  });
}
